package com.baobao.domain;

import java.io.Serializable;

import java.lang.StringBuilder;

import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

import javax.xml.bind.annotation.*;

import javax.persistence.*;

/**
 */

@Entity
@NamedQueries({
		@NamedQuery(name = "findAllStudents", query = "select myStudent from Student myStudent"),
		@NamedQuery(name = "findStudentByBbId", query = "select myStudent from Student myStudent where myStudent.bbId = ?1"),
		@NamedQuery(name = "findStudentByBbIdContaining", query = "select myStudent from Student myStudent where myStudent.bbId like ?1"),
		@NamedQuery(name = "findStudentByClassId", query = "select myStudent from Student myStudent where myStudent.classId = ?1"),
		@NamedQuery(name = "findStudentByClassIdContaining", query = "select myStudent from Student myStudent where myStudent.classId like ?1"),
		@NamedQuery(name = "findStudentById", query = "select myStudent from Student myStudent where myStudent.id = ?1"),
		@NamedQuery(name = "findStudentByIdContaining", query = "select myStudent from Student myStudent where myStudent.id like ?1"),
		@NamedQuery(name = "findStudentByName", query = "select myStudent from Student myStudent where myStudent.name = ?1"),
		@NamedQuery(name = "findStudentByNameContaining", query = "select myStudent from Student myStudent where myStudent.name like ?1"),
		@NamedQuery(name = "findStudentByPrimaryKey", query = "select myStudent from Student myStudent where myStudent.id = ?1"),
		@NamedQuery(name = "findStudentBySex", query = "select myStudent from Student myStudent where myStudent.sex = ?1") })
@Table(catalog = "baobaodb", name = "student")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(namespace = "bb/com/baobao/domain", name = "Student")
public class Student implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 */

	@Column(name = "id", length = 40, nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@Id
	@XmlElement
	String id;
	/**
	 */

	@Column(name = "name", length = 100)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String name;
	/**
	 */

	@Column(name = "class_id", length = 40)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String classId;
	/**
	 */

	@Column(name = "sex")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	Integer sex;
	/**
	 */

	@Column(name = "bb_id", length = 40)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String bbId;

	/**
	 */
	public void setId(String id) {
		this.id = id;
	}

	/**
	 */
	public String getId() {
		return this.id;
	}

	/**
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 */
	public String getName() {
		return this.name;
	}

	/**
	 */
	public void setClassId(String classId) {
		this.classId = classId;
	}

	/**
	 */
	public String getClassId() {
		return this.classId;
	}

	/**
	 */
	public void setSex(Integer sex) {
		this.sex = sex;
	}

	/**
	 */
	public Integer getSex() {
		return this.sex;
	}

	/**
	 */
	public void setBbId(String bbId) {
		this.bbId = bbId;
	}

	/**
	 */
	public String getBbId() {
		return this.bbId;
	}

	/**
	 */
	public Student() {
	}

	/**
	 * Copies the contents of the specified bean into this bean.
	 *
	 */
	public void copy(Student that) {
		setId(that.getId());
		setName(that.getName());
		setClassId(that.getClassId());
		setSex(that.getSex());
		setBbId(that.getBbId());
	}

	/**
	 * Returns a textual representation of a bean.
	 *
	 */
	public String toString() {

		StringBuilder buffer = new StringBuilder();

		buffer.append("id=[").append(id).append("] ");
		buffer.append("name=[").append(name).append("] ");
		buffer.append("classId=[").append(classId).append("] ");
		buffer.append("sex=[").append(sex).append("] ");
		buffer.append("bbId=[").append(bbId).append("] ");

		return buffer.toString();
	}

	/**
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = (int) (prime * result + ((id == null) ? 0 : id.hashCode()));
		return result;
	}

	/**
	 */
	public boolean equals(Object obj) {
		if (obj == this)
			return true;
		if (!(obj instanceof Student))
			return false;
		Student equalCheck = (Student) obj;
		if ((id == null && equalCheck.id != null) || (id != null && equalCheck.id == null))
			return false;
		if (id != null && !id.equals(equalCheck.id))
			return false;
		return true;
	}
}
